<html>

<head>

</head>

<body>
    <form action="#" id="form">
        姓名:<input type="text" id="username" placeholder="请输入用户名..."><br>
        密码:<input type="password" id="password" placeholder="请输入密码...">
    </form>
    <button id="submit">提交数据</button>
    <button id="reset">重置</button>
    <script>
        var form = document.getElementById("form");

        var submit = document.getElementById("submit");
        submit.onclick = function () {
            form.submit();
        }

        var reset = document.getElementById("reset");
        reset.onclick = function () {
            form.reset();
        }
    </script>


</body>

</html>